home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / comm / tcp / ATCP_src_22.lha / AmiTCP-2.2 / src / amitcp / api / allocdatabuffer.c next >
Encoding:
C/C++ Source or Header  |  1993-08-12  |  973 b   |  45 lines

  1. RCS_ID_C="$Id: allocdatabuffer.c,v 1.1 1993/06/12 22:57:18 too Exp $";
  2. /*
  3.  * Copyright (c) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
  4.  *                    Helsinki University of Technology, Finland.
  5.  *                    All rights reserved.
  6.  *
  7.  * Created: Sun Jun 13 01:09:17 1993 too
  8.  * Last modified: Sun Jun 13 01:36:24 1993 too
  9.  *
  10.  * HISTORY
  11.  * $Log: allocdatabuffer.c,v $
  12.  * Revision 1.1  1993/06/12  22:57:18  too
  13.  * Initial revision
  14.  *
  15.  *
  16.  */
  17.  
  18. #include <exec/types.h>
  19.  
  20. #include <sys/malloc.h>
  21.  
  22. #include <api/amiga_api.h>
  23. #include <api/allocdatabuffer.h>
  24.  
  25. BOOL doAllocDataBuffer(struct DataBuffer * DB, int size)
  26. {
  27.   if (DB->db_Addr)
  28.     bsd_free(DB->db_Addr, M_TEMP);
  29.   if ((DB->db_Addr = bsd_malloc(size, M_TEMP, M_WAITOK)) == NULL) {
  30.     DB->db_Size = 0;
  31.     return FALSE;
  32.   }
  33.   DB->db_Size = size;
  34.   return TRUE;
  35. }
  36.  
  37. VOID freeDataBuffer(struct DataBuffer * DB)
  38. {
  39.   if (DB->db_Addr)
  40.     bsd_free(DB->db_Addr, M_TEMP);
  41.   DB->db_Size = 0;
  42.   DB->db_Addr = NULL;
  43. }
  44.  
  45.